package cn.edu.nwsuaf.teachercenter.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * CourceEmployee entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "cource_employee", catalog = "exam")
public class CourceEmployee implements java.io.Serializable {

	// Fields

	private CourceEmployeeId id;
	private Teacher teacher;
	private Cource cource;
	private Sclass sclass;

	// Constructors

	/** default constructor */
	public CourceEmployee() {
	}

	/** full constructor */
	public CourceEmployee(CourceEmployeeId id, Teacher teacher, Cource cource,
			Sclass sclass) {
		this.id = id;
		this.teacher = teacher;
		this.cource = cource;
		this.sclass = sclass;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "courceNo", column = @Column(name = "cource_no", nullable = false, length = 50)),
			@AttributeOverride(name = "classNo", column = @Column(name = "class_no", nullable = false, length = 50)),
			@AttributeOverride(name = "teacherNo", column = @Column(name = "teacher_no", nullable = false, length = 50)) })
	public CourceEmployeeId getId() {
		return this.id;
	}

	public void setId(CourceEmployeeId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "teacher_no", nullable = false, insertable = false, updatable = false)
	public Teacher getTeacher() {
		return this.teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cource_no", nullable = false, insertable = false, updatable = false)
	public Cource getCource() {
		return this.cource;
	}

	public void setCource(Cource cource) {
		this.cource = cource;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "class_no", nullable = false, insertable = false, updatable = false)
	public Sclass getSclass() {
		return this.sclass;
	}

	public void setSclass(Sclass sclass) {
		this.sclass = sclass;
	}

}